Skip to content

maths: add autocorrelation function#14895

Open
zain-cs wants to merge 1 commit into
TheAlgorithms:masterfrom
zain-cs:add-autocorrelation
Open

maths: add autocorrelation function#14895
zain-cs wants to merge 1 commit into
TheAlgorithms:masterfrom
zain-cs:add-autocorrelation

Conversation

@zain-cs

@zain-cs zain-cs commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Adds an autocorrelation function to the maths directory.

Autocorrelation measures the correlation of a signal with a delayed copy of itself. It is widely used in time series analysis, signal processing, and statistics.

Changes

  • Added maths/autocorrelation.py with:
    • autocorrelation(data, lag) function
    • Full docstring with parameter descriptions
    • Doctests for valid and invalid inputs
    • ValueError for invalid lag or zero variance

References

Checklist

  • This PR only changes one algorithm file
  • All functions have type hints
  • All functions have doctests
  • Wikipedia reference included

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass labels Jul 3, 2026
@zain-cs zain-cs force-pushed the add-autocorrelation branch from 8ec8219 to b3f51ce Compare July 4, 2026 09:09
@zain-cs

zain-cs commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Cleaned up the commit history — squashed the pre-commit auto-fix commits and removed an unrelated commit that got mixed in during a rebase. This PR now contains a single commit for the autocorrelation function.

@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants